//
//  PrefixHeader.swift
//  Lover
//
//  Created by 冯俊武 on 2024/8/4.
//

import UIKit
import QMUIKit

let userId = "000001"
let userName = "系统管理员"

let screenWidth = UIScreen.main.bounds.width
let screenHeight = UIScreen.main.bounds.height

struct AppConfig {

    // 获取当前的 UIWindowScene
    private static var currentWindowScene: UIWindowScene? {
        return UIApplication.shared.connectedScenes.first as? UIWindowScene
    }

    // 状态栏高度
    static var statusBarHeight: CGFloat {
        return currentWindowScene?.statusBarManager?.statusBarFrame.height ?? 0
    }

    // 导航栏高度
    static var navigationBarHeight: CGFloat {
        if let rootViewController = currentWindowScene?.windows.first?.rootViewController as? UINavigationController {
            return rootViewController.navigationBar.frame.height
        }
        return 0
    }

    // 标签栏高度
     static var tabBarHeight: CGFloat {
        if let rootViewController = currentWindowScene?.windows.first?.rootViewController as? UITabBarController {
            return rootViewController.tabBar.frame.height
        }
        return 0
    }

    // 底部安全区域高度
    static var bottomSafeAreaHeight: CGFloat {
        return currentWindowScene?.windows.first?.safeAreaInsets.bottom ?? 0
    }
}

